<{include file="simple_header.tpl"}>
<div class="content">
	<div class="uploadi">
    	<div class="uploadi1">
    		<form action='/user/doEditBook' method='post' enctype="multipart/form-data" id='upForm'>
    				<div class="upname"><h1>编辑资源信息</h1></div>
                    <div class="uplist">
                    		<div class="myfile">
                            <span>资源文件：<{$pri.book_name}></span>
                            </div>
                    </div>
                    <div class="libraryi">
                    	<div class="uplist">
                            <span class="panname">该资源在您私人网盘上的介绍...</span>
                        </div>
                        <div class="uplist">
                    		<div class="uplistname"><span>资源名称:</span></div>
                            <div class="upvalue">
                                <div class="upinput">
                                    <div class="upinput1">
                                    <input type="text" class="text" value="<{$pri.book_name}>" name="priBookName" id='priBookName'>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="uplist">
                        <input type='hidden' id='selected_cid' value='<{$pri.fk_category}>' name='selected_cid'>
                            <div class="uplistname"><span>分类标签:</span></div>
                            <div class="upvalue"><div class="upinputs" id='upinputs'>
                            <{section loop=$cs name="ls"}>
                            <a href="javascript:void(0)" cid='<{$cs[ls].id}>' title="<{$cs[ls].name}>"><{$cs[ls].name}></a>
                            <{/section}>
                            </div>
                            <div class="am" id='newTagDiv'><a href="javascript:void(0)" id='newTagBtnUI'>+ 创建新标签</a></div>
                            <div class="am" id='doNewTagDiv' style='display:none'>
                            	<div class="creat">
                                <input type="text" class="creats" value="" id='newTag'>
                                <a href="javascript:void(0)" id='realCreate'>创建</a>
                                </div>
                                 <a href="javascript:void(0)" class="quxiao" id='cancelBtn'>取消</a>
                            </div>
                            </div>
                        </div>
                    </div>
                    <div class="library">
                        <div class="uplist">
<span class="tsgname">该资源在公共资源区的介绍，您可以参与编辑和修订工作，信息完整后将被推荐到公共资源区...（非必填）</span>
                        </div>
                        <div class="uplist">
                            <div class="uplistname"><span>图书名称:</span></div>
                            <div class="upvalue"><div class="upinput"><div class="upinput1">
                                <input type="text" class="text" value="<{$pub.book_name}>" name="pubBookName" id='pubBookName'>
                            </div></div></div>
                        </div>
                        <input type='hidden' name='book_id' value='<{$pub.book_id}>'>
                        <div class="uplist">
                            <div class="uplistname"><span>作者:</span></div>
                            <div class="upvalue">
                            	<div class="upinputw">
                                    <div class="upinputw1">
                                    <input type="text" class="textw" value="<{$pub.author}>" name="pubAuthor" id='pubAuthor'>
                                    </div>
                                </div>
                            </div>                        
                        </div>
                        
                        <div class="uplist">
                            <div class="uplistname"><span>图书封面<span>&nbsp;</span>:</span></div>
                            <div class="upvalue"><div class="upinputs">
                            <img src="http://www.5show5.com<{$pub.book_pic}>" width="128" height="168">
                            <input type="file" class="file" name="book_pic"></div></div>
                        </div>              
                        
                        <div class="uplist">
                            <div class="uplistname"><span>图书简介<span style="color:#C30"></span>:</span></div>
                            <div class="upvalue"><div class="upinputi">
                                <textarea class="introtext" name="book_desn" id='book_desn'><{$pub.book_desn}></textarea>
                            </div></div>
                        </div>
                    </div>
                    <div class="uplist">
                    	<div class="uplistname"><a href="javascript:void(0)" class="tijiao" id='subBtn'>点击提交</a></div>
                        <div class="upvalue"></div>
                    </div>  
    			</div>
    		</form>
    	</div>
    </div>
</div>
<script>
$(function(){
    var defaultCid = $('#selected_cid').val();
    $("#upinputs a[cid='"+defaultCid+"']").attr('class','flnow');
    $('#newTagBtnUI').click(function(){
        $('#newTagDiv').hide();
        $('#doNewTagDiv').show();
    });
    $('#cancelBtn').click(function(){
        $('#newTagDiv').show();
        $('#doNewTagDiv').hide();
    });	
    $('#upinputs a').click(function(){
        $('#upinputs a').attr('class','');
        $(this).attr('class','flnow');
        $('#selected_cid').val($(this).attr('cid'));
    });
    $('#realCreate').click(function(){
        var title = $.trim($('#newTag').val());
        if(title==''){
            alert('请填写分类名称');
            return;
        }
        $.post('/category/new',{'categoryName':title},function(data){
            if(data.success){
                $('#upinputs a').attr('class','');
                $('#upinputs').append("<a href='javascript:void(0)' class='flnow' cid='"+data.data+"'>"+title+"</a>");
                $('#selected_cid').val(data.data);
            }else{
                alert(data.message);
            }
        },'json');
    });
    $('#subBtn').click(function(){
    	$('#upForm').submit();
    });
});
</script>
<{include file="footer.tpl"}>
